<style>
  .shareSale-container{
    position:fixed;
    width:100%;
    bottom:0;
    left:0;
    display: none;
  }
  .shareSale-wrapper{
    display: flex;
    display:-webkit-box;
    -webkit-box-align: center;
    align-items:center;
    text-align:center;
  }
  .shareSale-collec{
    width:1.26rem;
    padding-top:0.55rem;
    box-sizing: border-box;
    height:1rem;
    font-size:0.24rem;
    color:#333333;
    background:url('__PUBLIC__/images/shareHD/fxzq_wsc.png') #f2f2f2 center 8px / 0.36rem 0.36rem no-repeat;
    text-align:center;
  }
  .shareSale-collec.on{
    background:url('__PUBLIC__/images/shareHD/fxzq_ysc.png') #f2f2f2 center 8px / 0.36rem 0.36rem no-repeat;
  }
  .shareSale-start{
    flex:1;
    -webkit-box-flex:1;
    width:100%;
    background-color:#f48d1d;
    color:#ffffff;
    font-size:0.36rem;
    height:1rem;
    line-height:1rem;
  } 
  .shareSale-share{
    font-size:0.36rem;
    height:1rem;
    flex:1;
    -webkit-box-flex:1;
    width:100%;
    color:#ffffff;
    line-height:1rem;
    background-color:#5a3004;
  }
  .guize_wrap{
    display: none;
    width:1.6rem;
    height:0.6rem;
    background:url('__PUBLIC__/images/shareHD/fxzq_fygz.png') 0% 0% / 100% 100% no-repeat;
    position: fixed;
    right:0;
    bottom:1.4rem;
  }
</style>
<div class="shareSale-container">
  <div class="shareSale-wrapper">
    <div class="shareSale-collec">收藏</div>
    <div class="shareSale-start J_formSubmit">领券开始测试</div>
    <div class="shareSale-share">分享奖励</div>
  </div>
</div>
<div class="guize_wrap"></div>
<script>
    const ISNATIVE='<!--{$csTypeNum}-->';//是否开启分享赚
    const collectionType='<!--{$collectionType}-->'; // 是否收藏
    console.log(ISNATIVE);

  $(function(){
    if(collectionType==1){
        $('.shareSale-collec').toggleClass('on');
    }

    if(ISNATIVE==1){
      $('#fiex').remove();
      $('.shareSale-container').show();
      $('.guize_wrap').show();
    }
  })
  $('.shareSale-collec').click(function(){
    $(this).toggleClass('on');
    if($(this).hasClass('on')){
      layer.msg("收藏成功");
        $.getJSON("<!--{:U('Share/addCollection','',false)}-->",function(data){//点击回调入库
            
        });
    }else{
      layer.msg("取消收藏");
        $.getJSON("<!--{:U('Share/deleteCollection','',false)}-->",function(data){//点击回调入库
           
        });
    }
  })
  let u = navigator.userAgent;
  let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  var AnimateFlag = true;
  $('.shareSale-start').on('click',function(){
    if(AnimateFlag){
      AnimateFlag = false;
      $('html,body').animate({scrollTop:$('#scrollT')[0].offsetTop},500,function(){AnimateFlag = true;})
    }
  });
  $('.shareSale-share').click(function(){
    console.log('分享奖励')
	  $.getJSON("<!--{:U('Share/shareCode','',false)}-->",{csName:'<!--{$csType}-->'},function(data){//点击回调入库
		   var data= JSON.stringify(data);
			//console.log(data);
			if(isiOS){
			  window.webkit.messageHandlers.earnshare.postMessage(data);
			}else{
			  android.earnshare(data);
			}
		  
	  });
  })
  $('.guize_wrap').click(function(){
      console.log('返佣规则')
      if(isiOS){
		    window.webkit.messageHandlers.toActivity.postMessage('sm://sm.mrkj.com/me/shareearn');
      }else{
         // android.toActivity('sm://sm.mrkj.com/me/earnmoney/deposit');
          android.toActivity('sm://sm.mrkj.com/me/shareearn');
      }

  })
</script>